export default {
  data () {
    return {
      todayBarOption: {
        grid: {
          top: 35,
          left: 0,
          right: 0,
          bottom: 20
        },
        xAxis: {
          type: 'category',
          axisLine: {
            show: false
          },
          axisTick: {
            show: false
          },
          axisLabel: {
            color: '#a8c5ed'
          },
          data: ['环境', '人员', '设备']
        },
        yAxis: {
          type: 'value',
          show: false
        },
        series: [{
          barWidth: 15,
          label: {
            show: true,
            color: '#fff',
            position: 'top'
          },
          itemStyle: {
            normal: {
              color: new this.$echarts.graphic.LinearGradient(
                0, 0, 0, 1,
                [
                  {offset: 0, color: '#ffb503'},
                  {offset: 1, color: '#ffe400'}
                ]
              )
            }
          },
          data: [5, 3, 2],
          type: 'bar'
        }]
      }
    }
  },
  methods: {
    initTodayBar () {
      this.todayBarOption.series[0].data = [this.todayAlarm.environmentAlarmNum, this.todayAlarm.personAlarmNum, this.todayAlarm.deviceAlarmNum]
      if (!this.todayBarOptionEchart) {
        this.todayBarOptionEchart = this.$echarts.init(this.$refs.warningTodayBar)
      }
      this.todayBarOptionEchart.setOption(this.todayBarOption)
    }
  }
}
